import React, { lazy } from 'react'
import { MainLayout } from '../components'
import {
  HomeOutlined,
  UnorderedListOutlined,
  SettingOutlined,
  PlusOutlined,
  AlignCenterOutlined,
} from '@ant-design/icons'
import { RouterRawState } from '../types'
const Home = lazy(() => import('../views/home'))
const Login = lazy(() => import('../views/login'))
const ListManage = lazy(() => import('../views/listManage'))
const ListAdd = lazy(() => import('../views/listAdd'))
const Set = lazy(() => import('../views/set'))

// admin
// user
// test

export const ROUTES_LIST: RouterRawState[] = [
  {
    path: '/',
    element: (
      <MainLayout>
        <Home></Home>
      </MainLayout>
    ),
    meta: {
      title: '首页',
      icon: <HomeOutlined />,
    },
  },
  {
    path: '/login',
    element: <Login></Login>,
    meta: {
      title: '登录',
      // 是否渲染导航菜单
      hidden: true,
    },
  },
  {
    path: '/list',
    children: [
      {
        path: '/list/manage',
        element: (
          <MainLayout>
            <ListManage></ListManage>
          </MainLayout>
        ),
        meta: {
          title: '列表管理',
          icon: <UnorderedListOutlined />,
        },
      },
      {
        path: '/list/manage/test',
        meta: {
          title: '列表测试',
          icon: <PlusOutlined />,
        },
        children: [
          {
            path: '/list/manage/test/1',
            element: (
              <MainLayout>
                <div>列表测试1</div>
              </MainLayout>
            ),
            meta: {
              title: '列表测试1',
            },
          },
          {
            path: '/list/manage/test/2',
            element: (
              <MainLayout>
                <div>列表测试2</div>
              </MainLayout>
            ),
            meta: {
              title: '列表测试2',
            },
          },
          {
            path: '/list/manage/test/add',
            element: (
              <MainLayout>
                <ListAdd></ListAdd>
              </MainLayout>
            ),
            meta: {
              title: '列表添加',
              roles: ['admin', 'test'],
            },
          },
        ],
      },
    ],
    meta: {
      title: '列表操作',
      icon: <AlignCenterOutlined />,
    },
  },
  {
    path: '/set',
    element: (
      <MainLayout>
        <Set></Set>
      </MainLayout>
    ),
    meta: {
      title: '设置',
      icon: <SettingOutlined />,
      roles: ['admin'],
    },
  },
]
